home *** CD-ROM | disk | FTP | other *** search
-
- /********************************************
- **** Animation Class Library V1.0 © 1994 Yves Schmid & Alia Development
- ****
- **** AnimGfx.h
- ****
- **** Created: 10 April 1994
- **** Modified: 01 Septembre 1994
- **** Version: 0
- **** Compatible: C++, Mac System 7
- ****
- **** Description: • AnimGfx is a simple class which handles an image in memory. AnimGfx
- **** is very fast because it does not work with pictures but only with
- **** pixmaps.
- ****
- **** • AnimGfx is a child class of CoreHead.
- ****
- *******************/
-
-
-
- #ifndef ANIMGFX_H
- #define ANIMGFX_H
-
- #include <QDOffscreen.h>
-
- #include "CoreHead.h"
-
- class AnimGfx : public CoreHead
- {
-
- //***********************************************************
- //.............. P U B L I C M E T H O D S.................
-
- public:
-
- AnimGfx();
- AnimGfx(CoreHead *supervisor, long entry =0); // If you want to link your object
- // to a supervisor (see CoreClass).
-
- ~AnimGfx();
-
- // This methods allow you get pointers on the PixMap or the GWorld. They may return NULL if
- // the object is empty (if it does not contains an image).
-
- inline PixMapHandle getpixmap(void) const {return (gworld)?GetGWorldPixMap(gworld):NULL;}
- inline GWorldPtr getgworld(void) const {return gworld;}
-
-
- virtual void purge(void); // Frees the current image. The object becomes empty.
-
-
- short getwidth(void) const; // Returns the size of the picture, return -1 if
- short getheight(void) const; // object is empty.
-
- virtual void createbypict(PicHandle pict); // Creates with a Picture handle
- virtual void createbypict(long pictres); // Creates with a Picture resource
- virtual void create(short width, short height); // Creates an empty pixmap
-
- virtual PicHandle createpict(void); // Creates a picture handle, copies the contains of the
- // internal pixmap into the picture and returns the
- // picture handle. It's up to you to free the pichandle
- // when you don't need it anymore.
-
-
- virtual void createmaskrgb(RGBColor *rgb =NULL);
- // Creates a mask using by default the white color to
- // fill the mask with zero bits. You can override this by giving
- // a RGBColor to "createmaskrgb".
-
- virtual void freemask(void);
-
- inline BitMap *getmask(void) {return mask;} // Returns mask or NULL
-
- inline unsigned long *getlinemask(void) {return linemask;} // Returns linemask or NULL.
- // A linemask is a one line mask
- // where all lines of the
- // principal mask have been ORed.
- // Useful for fast collision checking.
-
-
- virtual void draw(short x, short y, short tmode =srcCopy); // Draws the full object
-
- virtual void drawrect(Rect scr, short x, short y, short tmode =srcCopy); // Draws part of the object
-
- virtual void drawrect(Rect scr, Rect dest, short tmode =srcCopy); // Draws part of the object with
- // a scale to fit into the dest rect
-
- virtual void drawrect(Rect dest, short tmode =srcCopy); // Draws the full object with a scale
- // to fit into the dest rect
-
-
- virtual void setport(void); // The pixmap becomes the current port
- virtual void restoreport(void); // Restores the old port. Must be called after a setport!
-
-
- unsigned long userdata; // Use this variable like you want
-
-
-
-
- //***********************************************************
-
- private:
-
- GWorldPtr gworld; // private section
- BitMap *mask;
- unsigned long *linemask;
-
- CGrafPtr oldport;
- GDHandle olddevice;
-
- };
-
- #endif
-
-
-